package com.zx.controller.specification;

import com.zx.dto.request.goods.GoodsRequestDto;
import com.zx.dto.request.specification.SpecificationReqDto;
import com.zx.dto.response.brand.BrandDto;
import com.zx.dto.response.goods.GoodsDto;
import com.zx.dto.response.goods.GoodsListDtoResult;
import com.zx.dto.response.specification.SpecificationBrandDto;
import com.zx.service.brand.BrandService;
import com.zx.service.goods.GategoryGoodsService;
import com.zx.service.goods.GoodsService;
import com.zx.service.specification.SpecificationValueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author sunkai
 * @date 2022/8/8 0008 15:52
 * @mood zhou xun
 */
@Controller
@RequestMapping("/specification")
public class SpecificationController {
    @Autowired
    private SpecificationValueService service;

    @Autowired
    private BrandService brandService;

    @Autowired
    private GoodsService goodsService;

    @GetMapping("/value/goods")
    @ResponseBody
    public GoodsListDtoResult queryValueGoods(SpecificationReqDto specificationReqDto){
        return service.querySpecificationValue(specificationReqDto);
    }
    @GetMapping("/value")
    @ResponseBody
    public List<SpecificationBrandDto> querySpecification(GoodsRequestDto goodsRequestDto) {
        List<BrandDto> brandDtos = brandService.queryBrand(goodsRequestDto);
        return goodsService.querySpecificationValue(brandDtos,goodsRequestDto);
    }

}
